<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets logging level</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongolog.setcallback.html">MongoLog::setCallback</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongolog.setmodule.html">MongoLog::setModule</a></div>
 <div class="up"><a href="class.mongolog.html">MongoLog</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mongolog.setlevel" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoLog::setLevel</h1>
  <p class="verinfo">(PECL mongo &gt;= 1.2.3)</p><p class="refpurpose"><span class="refname">MongoLog::setLevel</span> &mdash; <span class="dc-title">Sets logging level</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongolog.setlevel-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>MongoLog::setLevel</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$level</code></span>
   )</div>

  <p class="para rdfs-comment">
   This function can be used to set how verbose logging should be and the types
   of activities that should be logged. Use the constants described in the
   <a href="class.mongolog.html" class="classname">MongoLog</a> section with bitwise operators to specify
   levels.
  </p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;first,&nbsp;turning&nbsp;on&nbsp;logging&nbsp;for&nbsp;a&nbsp;module<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setModule</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">POOL</span><span style="color: #007700">);<br /><br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;messages&nbsp;of&nbsp;every&nbsp;level<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">ALL</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;warnings&nbsp;and&nbsp;info<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">WARNING</span><span style="color: #007700">|</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">INFO</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;log&nbsp;everything&nbsp;except&nbsp;fine&nbsp;activity<br /></span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">setLevel</span><span style="color: #007700">(</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">ALL&nbsp;</span><span style="color: #007700">&amp;&nbsp;(~</span><span style="color: #0000BB">MongoLog</span><span style="color: #007700">::</span><span style="color: #0000BB">FINE</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

  <p class="para">
   Note that you must also call <span class="function"><a href="mongolog.setmodule.html" class="function">MongoLog::setModule()</a></span> to
   choose what part of the driver to log.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongolog.setlevel-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>

      <em><code class="parameter">level</code></em>
     </dt>

     <dd>

      <p class="para">
       The levels you would like to log.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mongolog.setcallback.html">MongoLog::setCallback</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mongolog.setmodule.html">MongoLog::setModule</a></div>
 <div class="up"><a href="class.mongolog.html">MongoLog</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
